<template>
  <div class="page-header">
    <div class="left">
      <h2 class="title">{{ title }}</h2>
      <div class="breadcrumb" v-if="showBreadcrumb">
        <el-breadcrumb separator="/">
          <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
          <el-breadcrumb-item v-if="parentRoute" :to="{ path: parentPath }">
            {{ parentRoute }}
          </el-breadcrumb-item>
          <el-breadcrumb-item>{{ currentRoute }}</el-breadcrumb-item>
        </el-breadcrumb>
      </div>
    </div>
    <div class="right">
      <slot name="actions"></slot>
    </div>
  </div>
</template>

<script>
export default {
  name: 'PageHeader',
  props: {
    title: {
      type: String,
      required: true
    },
    showBreadcrumb: {
      type: Boolean,
      default: true
    },
    parentRoute: {
      type: String,
      default: ''
    },
    parentPath: {
      type: String,
      default: ''
    },
    currentRoute: {
      type: String,
      required: true
    }
  }
}
</script>

<style scoped>
.page-header {
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.title {
  margin: 0;
  font-size: 22px;
  font-weight: bold;
  color: #303133;
  margin-bottom: 10px;
}

.breadcrumb {
  margin-top: 5px;
}

.left {
  flex: 1;
}

.right {
  display: flex;
  align-items: center;
}
</style> 